<html>
<head>
<meta http-equiv="refresh" content="7;url=http://113.215.1.161"> 
</head>
<body>
<?php 
function updateDB($domain,$stat){
$domain=trim($domain);
$stat=trim($stat);
echo $domain."<br>";
header("Content-type: text/html; charset=utf-8");
$con = mysql_connect("113.215.1.161","root","root");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }
//code
mysql_select_db("mydb", $con);//选库
mysql_query("set names 'utf8'");
$res=mysql_query("SELECT * FROM CDN_domainTab WHERE Domain='$domain'");
if (!mysql_num_rows($res)) 
{
	echo "该域名不存在<br>";
}
else
{
	mysql_query("UPDATE CDN_domainTab SET mon='$stat' WHERE Domain='$domain'");#修改为no
	echo "完成修改！<br>";
	$res=mysql_query("SELECT * FROM CDN_domainTab WHERE Domain='$domain'");#再次查询
	$row = mysql_fetch_array($res, MYSQL_ASSOC);
	echo $row['Domain']."监控状态为：".$row['mon']."<br>";
	mysql_close($con);
}

}

$domains=$_POST["domain"];
$stat=$_POST["stat"];
foreach ($domains as$domain) {

	updateDB($domain,$stat);
}
echo "<br>5秒后回到页面";
?>
</body>
</html>